#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;

class Solution{
    public:
    bool ans1(vector<vector<int>>& matrix, int target){
        int m = matrix.size(), n = matrix[0].size();
        for(int i = 0; i != m; i++){
            for(int j = 0; j != n; j++){
                if(matrix[i][j] == target){
                    return true;
                }
            }
        }
        return false;
    }
};

void test1(){
    Solution s;
    vector<vector<int>> matrix = {
        {1,3,5,7},
        {10,11,16,20},
        {23,30,34,60}
    };
    int target = 3;

    bool ret = s.ans1(matrix, target);
    cout << ret << endl;
}

void test2(){
    Solution s;
    vector<vector<int>> matrix = {
        {1,3,5,7},
        {10,11,16,20},
        {23,30,34,60}
    };
    int target = 13;

    bool ret = s.ans1(matrix, target);
    cout << ret << endl;
}

int main(void){
    test1();
    test2();

    return 0;
}